package com.tang.model.composite.safe;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/8/22 20:49
 * @Desc 组合模式的安全写法
 * @Remarks
 */
public class SafeTest {
    public static void main(String[] args) {
        File qq = new File("QQ.exe");
        File wx = new File("wx.exe");
        Folder folder = new Folder("办公软件", 2);
        File ppt = new File("ppt.exe");
        File word = new File("word.exe");
        File excel = new File("excel.exe");
        folder.addDirictory(ppt);
        folder.addDirictory(word);
        folder.addDirictory(excel);
        Folder root = new Folder("D", 1);
        root.addDirictory(qq);
        root.addDirictory(wx);
        root.addDirictory(folder);
        root.show();
        System.out.println("==============");
        root.list();
    }
}
